//package com.quartet.modules.equipment.controller;
//
//
//import cn.hutool.core.bean.BeanUtil;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.api.ApiController;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.quartet.api.ApiResult;
//import com.quartet.api.PageResult;
//import com.quartet.modules.equipment.dto.TDataForwardRuleInfoAddRequestDto;
//import com.quartet.modules.equipment.dto.TDataForwardRuleInfoQueryRequestDto;
//import com.quartet.modules.equipment.dto.TDataForwardRuleInfoResponseDto;
//import com.quartet.modules.equipment.entity.TDataForwardRuleInfo;
//import com.quartet.modules.equipment.service.TDataForwardRuleInfoService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * 数据转发规则信息表(TDataForwardRuleInfo)表控制层
// *
// * @author makejava
// * @since 2021-05-04 16:31:05
// */
//@RestController
//@RequestMapping("tDataForwardRuleInfo")
//@Api(tags = "业务：数据转发规则信息")
//@Slf4j
//public class TDataForwardRuleInfoController  {
//    /**
//     * 服务对象
//     */
//    @Resource
//    private TDataForwardRuleInfoService tDataForwardRuleInfoService;
//
//    /**
//     * 分页查询所有数据
//     *
//     * @param tDataForwardRuleInfoQueryRequestDto 查询实体
//     * @return 所有数据
//     */
//    @ApiOperation("分页查询所有数据转发规则信息")
//    @PostMapping("/selectDataForwardRulePage")
//    public ApiResult<PageResult<TDataForwardRuleInfoResponseDto>> selectDataForwardRulePage(@RequestBody TDataForwardRuleInfoQueryRequestDto tDataForwardRuleInfoQueryRequestDto) {
//        log.info("---------selectDataForwardRulePage begin, tDataForwardRuleInfoQueryRequestDto is {}----------", tDataForwardRuleInfoQueryRequestDto);
//        IPage<TDataForwardRuleInfo> page = new Page<>(tDataForwardRuleInfoQueryRequestDto.getCurrent(), tDataForwardRuleInfoQueryRequestDto.getLimit());
//        QueryWrapper<TDataForwardRuleInfo> queryWrapper = new QueryWrapper<>();
//        if (!StringUtils.isNotBlank(tDataForwardRuleInfoQueryRequestDto.getForwardingName())) {
//            queryWrapper.lambda().like(TDataForwardRuleInfo::getForwardingName, tDataForwardRuleInfoQueryRequestDto.getForwardingName());
//        }
//        IPage<TDataForwardRuleInfo> dbResult = tDataForwardRuleInfoService.page(page, queryWrapper);
//        PageResult<TDataForwardRuleInfoResponseDto> pageResult = new PageResult();
//        List<TDataForwardRuleInfoResponseDto> tDataForwardRuleInfoResponseDtoList = dbResult.getRecords().stream().map(tDataForwardRuleInfo -> {
//            TDataForwardRuleInfoResponseDto tDataForwardRuleInfoResponseDto = BeanUtil.copyProperties(tDataForwardRuleInfo, TDataForwardRuleInfoResponseDto.class);
//            return tDataForwardRuleInfoResponseDto;
//        }).collect(Collectors.toList());
//        pageResult.setTotal(dbResult.getTotal());
//        pageResult.setData(tDataForwardRuleInfoResponseDtoList);
//        log.info("---------selectDataForwardRulePage end, data is {}----------", pageResult);
//        return ApiResult.ok(pageResult);
//    }
//
//    /**
//     * 新增数据
//     *
//     * @param tDataForwardRuleInfoAddRequestDto 实体对象
//     * @return 新增结果
//     */
//    @ApiOperation("添加数据转发规则信息")
//    @PostMapping("/add")
//    public ApiResult addDataForwardRule(@RequestBody TDataForwardRuleInfoAddRequestDto tDataForwardRuleInfoAddRequestDto) {
//        log.info("---------addDataForwardRule begin, tDataForwardRuleInfoAddRequestDto is {}----------", tDataForwardRuleInfoAddRequestDto);
//        TDataForwardRuleInfo tDataForwardRuleInfo = BeanUtil.copyProperties(tDataForwardRuleInfoAddRequestDto, TDataForwardRuleInfo.class);
//        return ApiResult.ok(this.tDataForwardRuleInfoService.save(tDataForwardRuleInfo));
//    }
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @ApiOperation("通过主键查询单条数据转发规则信息")
//    @GetMapping("/selectDataForwardRuleById")
//    public ApiResult<TDataForwardRuleInfoResponseDto> selectDataForwardRuleById(@RequestParam("id") Integer id) {
//        log.info("---------selectDataForwardRuleById begin, id is {}----------", id);
//        TDataForwardRuleInfo tDataForwardRuleInfo = tDataForwardRuleInfoService.getById(id);
//        TDataForwardRuleInfoResponseDto tDataForwardRuleInfoResponseDto = BeanUtil.copyProperties(tDataForwardRuleInfo, TDataForwardRuleInfoResponseDto.class);
//        return ApiResult.ok(tDataForwardRuleInfoResponseDto);
//    }
//
//    /**
//     * 修改数据
//     *
//     * @param tDataForwardRuleInfoAddRequestDto 实体对象
//     * @return 修改结果
//     */
//    @ApiOperation("修改数据转发规则信息")
//    @PutMapping("/update")
//    public ApiResult updateDataForwardRule(@RequestBody TDataForwardRuleInfoAddRequestDto tDataForwardRuleInfoAddRequestDto) {
//        log.info("---------updateDataForwardRule begin, tDataForwardRuleInfoAddRequestDto is {}----------", tDataForwardRuleInfoAddRequestDto);
//        TDataForwardRuleInfo tDataForwardRuleInfo = BeanUtil.copyProperties(tDataForwardRuleInfoAddRequestDto, TDataForwardRuleInfo.class);
//        return ApiResult.ok(this.tDataForwardRuleInfoService.updateById(tDataForwardRuleInfo));
//    }
//
//    /**
//     * 删除数据
//     *
//     * @param id 主键结合
//     * @return 删除结果
//     */
//    @ApiOperation("删除数据转发规则信息")
//    @DeleteMapping("/delete")
//    public ApiResult deleteDataForwardRule(@RequestParam("id") Integer id) {
//        return ApiResult.ok(this.tDataForwardRuleInfoService.removeById(id));
//    }
//}
